{{- /*
@param {string} (positional parameter 0) Tag name.

@returns {template.HTML}

@examples

  {{< tag "linux" >}}
*/ -}}

{{- if (.Get 0) -}}

    {{- $text := (.Get 0) -}}
    {{- $tag := (site.GetPage (printf "tags/%s" ($text))) -}}
    {{- $cat := (site.GetPage (printf "categories/%s" ($text))) -}}

    {{- if ($tag) -}}
      <span class="shortcode shortcode-{{ ($.Name) }}"><a href="{{ ($tag.RelPermalink) }}" target="_blank">#{{ ($text) }}</a></span>
    {{- else if ($cat) -}}
      <span class="shortcode shortcode-{{ ($.Name) }}"><a href="{{ ($cat.RelPermalink) }}" target="_blank">#{{ ($text) }}</a></span>
    {{- else -}}
      <span class="shortcode shortcode-{{ ($.Name) }}">{{- ($text) -}}</span>
    {{- end -}}

{{- else -}}

    {{ (partial "alerts/no_params" .) }}

{{- end -}}
